﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DoveyDelegateEvent
{
    public delegate void Handler(string name);

    public class Student
    {
       
        public int Id { get; set; }
        public string Name { get; set; }
        public void SayHi(string name) {
            Console.WriteLine($"{name},你好");
        }
        

        public void SayHiEveryOne(string name,Handler handler) {
            Console.WriteLine("写日志。。。。。。。。。。。。。。");
            handler(name);
        }
        public void SayHiEveryOneAction(string name, Action<string> handler)
        {
            Console.WriteLine("写日志。。。。。。。。。。。。。。");
            handler(name);
        }




        public void ChineseSayHi(string name) {
            Console.WriteLine($"{name},你好");
        }
        public void AmericanSayHi(string name) {
            Console.WriteLine($"{name},Hello");
        }
        public void AnyOneSayHi(string name) {
            Console.WriteLine($"{name},AnyOneSayHi");
        }


        /// <summary>
        /// 不稳定，
        /// </summary>
        /// <param name="name"></param>
        /// <param name="personType"></param>
        public void SayHiByCountry(string name, PersonType personType)
        {
            Console.WriteLine("写日志。。。。。。。。。。。。。。");
            switch (personType)
            {
                case PersonType.Chinese:
                    Console.WriteLine($"{name},你好");
                    break;
                case PersonType.American:
                    Console.WriteLine($"{name},Hello");
                    break;
                default:
                    throw new Exception("不能识别的类型");
            }
        }
        /// <summary>
        /// 不稳定，
        /// </summary>
        /// <param name="name"></param>
        /// <param name="personType"></param>
        public void SayHiByCountryTwo(string name, PersonType personType)
        {
            Console.WriteLine("写日志。。。。。。。。。。。。。。");
            switch (personType)
            {
                case PersonType.Chinese:
                    //Console.WriteLine($"{name},你好");
                    ChineseSay();
                    break;
                case PersonType.American:
                    //Console.WriteLine($"{name},Hello");
                    AmericanSay();
                    break;
                default:
                    throw new Exception("不能识别的类型");
            }
        }
        public void ChineseSay() {
            Console.WriteLine("发通知短信");
        }
        public void AmericanSay() {
            Console.WriteLine("发通知短信");

        }
    }
    
    public enum PersonType { 
        Chinese=1,
        American = 2,
        Japanlise = 3,
    }
}
